using System.ComponentModel.DataAnnotations;

namespace BlazorResetModel;

public class Command(int id, string name, string[] commands)
{
	public int Id { get; set; } = id;

	[MinLength(3)]
	public string Name { get; set; } = name;

	[MinLength(3)]
	public string[] Commands { get; set; } = commands;

	public string CommandsAsString
	{
		get => string.Join('\n', Commands);
		set
		{
			var lines = value.Split('\n', StringSplitOptions.RemoveEmptyEntries);
			Commands = lines;
		}
	}
}

